<template>
	<view class="universe-explorer">
		<!-- 顶部导航区域 -->
		<view class="header">
			<view class="header-left">
				<view class="compass-icon">
					<text class="compass-symbol">🧭</text>
				</view>
				<view class="header-text">
					<text class="title">宇宙探索</text>
					<text class="subtitle">已入驻0个星球</text>
				</view>
			</view>
			<view class="header-right">
				<view class="profile-indicators">
					<view class="indicator brain">
						<text class="indicator-icon">🧠</text>
						<text class="indicator-number">29</text>
					</view>
					<view class="indicator overlap">
						<view class="overlap-circle yellow">
							<text class="overlap-number">7</text>
						</view>
						<view class="overlap-circle red">
							<text class="overlap-number">1</text>
						</view>
					</view>
					<view class="indicator outline" @click="showNearbyResources">
						<text class="outline-icon">⚪</text>
					</view>
					<view class="indicator profile" @click="goToProfile">
						<text class="profile-icon">👤</text>
					</view>
				</view>
			</view>
		</view>

		<!-- AI智能搜索区域 -->
		<view class="search-section">
			<view class="search-bar">
				<text class="search-icon">🧠</text>
				<input class="search-input" placeholder="AI智能搜索 - 探索宇宙资源..." placeholder-style="color: rgba(255, 255, 255, 0.8);" />
			</view>
		</view>

		<!-- AI智能推荐区域 -->
		<view class="recommendations-section">
			<view class="section-header">
				<text class="section-icon">🧠</text>
				<text class="section-title">AI智能推荐</text>
			</view>
			<text class="section-description">基于您的兴趣和行业匹配的星球</text>
			
			<view class="recommendation-cards">
				<view class="card ecommerce">
					<text class="card-icon">🛍️</text>
					<view class="card-content">
						<view class="card-header">
							<text class="card-title">电商星球</text>
							<view class="ai-tag">
								<text class="ai-tag-text">AI推荐</text>
							</view>
						</view>
						<text class="card-description">电商运营策略、平台管理技巧、流量获取方法和转化率优化实战</text>
					</view>
				</view>
				
				<view class="card store">
					<text class="card-icon">🏪</text>
					<view class="card-content">
						<view class="card-header">
							<text class="card-title">店铺星球</text>
							<view class="ai-tag">
								<text class="ai-tag-text">AI推荐</text>
							</view>
						</view>
						<text class="card-description">实体店铺经营管理、门店营销策略、顾客体验优化和数字化转型</text>
					</view>
				</view>
				
				<view class="card chemical">
					<text class="card-icon">🧪</text>
					<view class="card-content">
						<view class="card-header">
							<text class="card-title">化工星球</text>
							<view class="ai-tag">
								<text class="ai-tag-text">AI推荐</text>
							</view>
						</view>
						<text class="card-description">化工技术创新、安全生产管理、环保合规要求和产业升级方案</text>
					</view>
				</view>
			</view>
			
			<view class="view-more-btn">
				<text class="view-more-text">查看更多推荐 (21)</text>
			</view>
		</view>

		<!-- 底部探索区域 -->
		<view class="explore-section">
			<view class="explore-icon" @click="goToPlanet">
				<text class="explore-symbol">🧭</text>
			</view>
			<text class="explore-title">开始您的宇宙探索之旅</text>
			<text class="explore-description">加入星球,发现无限资源和商业机会</text>
			<view class="explore-btn" @click="goToPlanet">
				<text class="btn-icon">⚡</text>
				<text class="btn-text">探索推荐星球</text>
			</view>
		</view>

		<!-- 附近未注册资源弹窗 -->
		<view class="popup-overlay" v-if="showNearbyPopup" @click="closeNearbyResources">
			<view class="popup-container" @click.stop>
				<view class="popup-header">
					<view class="popup-title">
						<text class="popup-icon">🧭</text>
						<text class="popup-title-text">附近未注册资源</text>
					</view>
					<text class="popup-close" @click="closeNearbyResources">✕</text>
				</view>
				<view class="popup-description">发现您周围尚未入驻平台的潜在资源</view>
				
				<view class="resource-card">
					<view class="resource-image">
						<text class="resource-icon">🏢</text>
					</view>
					<view class="resource-content">
						<text class="resource-title">创新科技园区</text>
						<text class="resource-desc">新兴科技园区,多家AI公司聚集,尚未入驻平台</text>
						<view class="resource-tags">
							<text class="resource-tag">科技园</text>
							<text class="resource-tag">AI</text>
						</view>
						<text class="resource-distance">距离 0.5km</text>
					</view>
					<view class="invite-button" @click="inviteResource">
						<text class="invite-icon">👥</text>
						<text class="invite-text">邀请入驻</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showNearbyPopup: false
			}
		},
		onLoad() {
			console.log('宇宙探索页面加载')
		},
		methods: {
			goToProfile() {
				uni.navigateTo({
					url: '/pages/profile/profile'
				})
			},
			goToPlanet() {
				uni.navigateTo({
					url: '/pages/planet/planet'
				})
			},
			showNearbyResources() {
				this.showNearbyPopup = true
			},
			closeNearbyResources() {
				this.showNearbyPopup = false
			},
			inviteResource() {
				uni.showToast({
					title: '邀请已发送',
					icon: 'success'
				})
				this.closeNearbyResources()
			}
		}
	}
</script>

<style lang="scss" scoped>
.universe-explorer {
	min-height: 100vh;
	background: radial-gradient(circle at 20% 80%, #7877c64d 0%, #0000 50%), radial-gradient(circle at 80% 20%, #ff77c64d 0%, #0000 50%), radial-gradient(circle at 40% 40%, #7877c633 0%, #0000 50%), linear-gradient(135deg, #0a0a0f 0%, #1a0a2e 25%, #16213e 50%, #0f3460 75%, #0e4b99 100%);
	padding: 50rpx 45rpx;
	display: flex;
	flex-direction: column;
	gap: 35rpx;
}

/* 顶部导航区域 */
.header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20rpx 0;
	border: 1px solid #fff3;
	border-radius: 16rpx;
	padding: 20rpx 24rpx;
	
	.header-left {
		display: flex;
		align-items: center;
		gap: 20rpx;
		
		.compass-icon {
			width: 60rpx;
			height: 60rpx;
			background: linear-gradient(135deg, #8b5cf6, #6366f1);
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			box-shadow: 0 8rpx 32rpx rgba(139, 92, 246, 0.3);
			
			.compass-symbol {
				font-size: 32rpx;
				color: white;
			}
		}
		
		.header-text {
			display: flex;
			flex-direction: column;
			gap: 8rpx;
			
			.title {
				font-size: 36rpx;
				font-weight: bold;
				color: white;
			}
			
			.subtitle {
				font-size: 24rpx;
				color: rgba(255, 255, 255, 0.7);
			}
		}
	}
	
	.header-right {
		.profile-indicators {
			display: flex;
			align-items: center;
			gap: 16rpx;
			
			.indicator {
				position: relative;
				
				&.brain {
					width: 48rpx;
					height: 48rpx;
					background: linear-gradient(135deg, #3b82f6, #1d4ed8);
					border-radius: 50%;
					display: flex;
					align-items: center;
					justify-content: center;
					
					.indicator-icon {
						font-size: 24rpx;
						color: white;
					}
					
					.indicator-number {
						position: absolute;
						bottom: -8rpx;
						right: -8rpx;
						background: #ef4444;
						color: white;
						font-size: 20rpx;
						border-radius: 50%;
						width: 24rpx;
						height: 24rpx;
						display: flex;
						align-items: center;
						justify-content: center;
					}
				}
				
				&.overlap {
					position: relative;
					
					.overlap-circle {
						width: 32rpx;
						height: 32rpx;
						border-radius: 50%;
						display: flex;
						align-items: center;
						justify-content: center;
						position: absolute;
						
						&.yellow {
							background: #fbbf24;
							top: 0;
							left: 0;
							z-index: 2;
							
							.overlap-number {
								font-size: 18rpx;
								color: white;
								font-weight: bold;
							}
						}
						
						&.red {
							background: #ef4444;
							top: 8rpx;
							left: 8rpx;
							z-index: 1;
							
							.overlap-number {
								font-size: 18rpx;
								color: white;
								font-weight: bold;
							}
						}
					}
				}
				
				&.outline {
					width: 32rpx;
					height: 32rpx;
					border: 2rpx solid #3b82f6;
					border-radius: 50%;
					display: flex;
					align-items: center;
					justify-content: center;
					
					.outline-icon {
						font-size: 16rpx;
						color: #3b82f6;
					}
				}
				
				&.profile {
					width: 48rpx;
					height: 48rpx;
					background: linear-gradient(135deg, #10b981, #059669);
					border-radius: 50%;
					display: flex;
					align-items: center;
					justify-content: center;
					
					.profile-icon {
						font-size: 24rpx;
						color: white;
					}
				}
			}
		}
	}
}

/* 搜索区域 */
.search-section {
	.search-bar {
		background: rgba(255, 255, 255, 0.1);
		backdrop-filter: blur(20rpx);
		border-radius: 32rpx;
		padding: 12rpx 32rpx;
		display: flex;
		align-items: center;
		gap: 20rpx;
		border: 2rpx solid rgba(255, 255, 255, 0.2);
		
		.search-icon {
			font-size: 28rpx;
			color: rgba(59, 130, 246, 0.7);
		}
		
		.search-input {
			font-size: 26rpx;
			color: rgba(255, 255, 255, 0.9);
			flex: 1;
			background: transparent;
			border: none;
			outline: none;
		}
	}
}

/* 推荐区域 */
.recommendations-section {
	display: flex;
	flex-direction: column;
	gap: 25rpx;
	
	.section-header {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 16rpx;
		
		.section-icon {
			font-size: 32rpx;
			color: #3b82f6;
		}
		
		.section-title {
			font-size: 36rpx;
			font-weight: bold;
			color: white;
		}
	}
	
	.section-description {
		font-size: 26rpx;
		color: rgba(255, 255, 255, 0.7);
		text-align: center;
	}
	
	.recommendation-cards {
		display: flex;
		flex-direction: column;
		gap: 24rpx;
		
		.card {
			background: rgba(255, 255, 255, 0.05);
			backdrop-filter: blur(20rpx);
			border-radius: 28rpx;
			padding: 24rpx 32rpx;
			border: 1rpx solid rgba(255, 255, 255, 0.15);
			position: relative;
			display: flex;
			align-items: center;
			gap: 20rpx;
			
			.card-icon {
				width: 70rpx;
				height: 70rpx;
				background: linear-gradient(135deg, #8b5cf6, #6366f1);
				border-radius: 50%;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 32rpx;
				color: white;
				box-shadow: 0 4rpx 16rpx rgba(139, 92, 246, 0.3);
				flex-shrink: 0;
			}
			
			.card-content {
				flex: 1;
				display: flex;
				flex-direction: column;
				gap: 12rpx;
				
				.card-header {
					display: flex;
					align-items: center;
					gap: 12rpx;
					
					.card-title {
						font-size: 30rpx;
						color: white;
					}
					
					.ai-tag {
						background: #6a5f8a;
						border-radius: 20rpx;
						padding: 4rpx 12rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						
						.ai-tag-text {
							font-size: 18rpx;
							color: rgba(255, 255, 255, 0.6);
						}
					}
				}
				
				.card-description {
					font-size: 24rpx;
					color: rgba(255, 255, 255, 0.7);
					line-height: 1.5;
				}
			}
			
			&.ecommerce .card-icon {
				color: #f59e0b;
			}
			
			&.store .card-icon {
				color: #10b981;
			}
			
			&.chemical .card-icon {
				color: #8b5cf6;
			}
		}
	}
	
	.view-more-btn {
		align-self: center;
		background: rgba(255, 255, 255, 0.1);
		border-radius: 20rpx;
		padding: 10rpx 40rpx;
		border: 2rpx solid rgba(255, 255, 255, 0.2);
		display: flex;
		align-items: center;
		justify-content: center;
		
		.view-more-text {
			font-size: 22rpx;
			color: rgba(255, 255, 255, 0.8);
		}
	}
}

/* 底部探索区域 */
.explore-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 30rpx;
	// margin-top: auto;
	padding-top: 60rpx;
	
	.explore-icon {
		width: 120rpx;
		height: 120rpx;
		background: linear-gradient(135deg, #8b5cf6, #6366f1);
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 16rpx 64rpx rgba(139, 92, 246, 0.4);
		transition: all 0.3s ease;
		cursor: pointer;
		
		&:active {
			transform: scale(0.95);
			box-shadow: 0 8rpx 32rpx rgba(139, 92, 246, 0.6);
		}
		
		.explore-symbol {
			font-size: 48rpx;
			color: white;
		}
	}
	
	.explore-title {
		font-size: 32rpx;
		font-weight: bold;
		color: white;
		text-align: center;
	}
	
	.explore-description {
		font-size: 26rpx;
		color: rgba(255, 255, 255, 0.7);
		text-align: center;
		line-height: 1.6;
	}
	
	.explore-btn {
		background: linear-gradient(135deg, #8b5cf6, #6366f1);
		border-radius: 20rpx;
		padding: 12rpx 48rpx;
		display: flex;
		align-items: center;
		gap: 16rpx;
		box-shadow: 0 8rpx 32rpx rgba(139, 92, 246, 0.3);
		transition: all 0.3s ease;
		cursor: pointer;
		
		&:active {
			transform: scale(0.95);
			box-shadow: 0 4rpx 16rpx rgba(139, 92, 246, 0.5);
		}
		
		.btn-icon {
			font-size: 20rpx;
			color: white;
		}
		
		.btn-text {
			font-size: 24rpx;
			color: white;
		}
	}
}

/* 弹窗样式 */
.popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(10rpx);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.popup-container {
	background: rgba(255, 255, 255, 0.95);
	border-radius: 24rpx;
	padding: 40rpx;
	margin: 40rpx;
	max-width: 600rpx;
	width: 100%;
	box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
}

.popup-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	
	.popup-title {
		display: flex;
		align-items: center;
		gap: 12rpx;
		
		.popup-icon {
			font-size: 32rpx;
			color: #f59e0b;
		}
		
		.popup-title-text {
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
		}
	}
	
	.popup-close {
		font-size: 36rpx;
		color: #999999;
		padding: 8rpx;
		cursor: pointer;
	}
}

.popup-description {
	width: 100%;
	text-align: center;
	font-size: 26rpx;
	color: #666666;
	margin-bottom: 30rpx;
	line-height: 1.5;
}

.resource-card {
	background: rgba(255, 255, 255, 0.8);
	border-radius: 20rpx;
	padding: 24rpx;
	display: flex;
	align-items: center;
	gap: 20rpx;
	border: 1rpx solid rgba(0, 0, 0, 0.1);
	
	.resource-image {
		width: 80rpx;
		height: 80rpx;
		background: linear-gradient(135deg, #8b5cf6, #6366f1);
		border-radius: 16rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		
		.resource-icon {
			font-size: 36rpx;
			color: white;
		}
	}
	
	.resource-content {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 8rpx;
		
		.resource-title {
			font-size: 28rpx;
			font-weight: bold;
			color: #333333;
		}
		
		.resource-desc {
			font-size: 24rpx;
			color: #666666;
			line-height: 1.4;
		}
		
		.resource-tags {
			display: flex;
			gap: 8rpx;
			margin-top: 4rpx;
			
			.resource-tag {
				background: #f5f5f5;
				color: #666666;
				font-size: 20rpx;
				padding: 4rpx 12rpx;
				border-radius: 12rpx;
			}
		}
		
		.resource-distance {
			font-size: 22rpx;
			color: #999999;
			margin-top: 4rpx;
		}
	}
	
	.invite-button {
		background: linear-gradient(135deg, #8b5cf6, #6366f1);
		border-radius: 16rpx;
		padding: 12rpx 20rpx;
		display: flex;
		align-items: center;
		gap: 8rpx;
		cursor: pointer;
		
		.invite-icon {
			font-size: 20rpx;
			color: white;
		}
		
		.invite-text {
			font-size: 24rpx;
			color: white;
			font-weight: bold;
		}
	}
}
</style>
